Given /^I am on the Newegg default page$/ do
  @browser.goto("www.newegg.com")
end

When /^I click on the login button$/ do
  if @browser.link(:text => 'Log in or Register').exists?
    @browser.link(:text => 'Log in or Register').click
  end
end

And /^enter my valid username$/ do
  if @browser.text_field(:id, "UserName").exists?
    @browser.text_field(:id => 'UserName').set 'littleklink@yahoo.com'
  end
end

And /^enter my valid password$/ do
  if @browser.text_field(:id => 'UserPwd').exists?
    @browser.text_field(:id => 'UserPwd').set 'KellenRoss0!'
  end
end

And /^click on the Submit button$/ do
  if @browser.button(:id => 'submit').exists?
    @browser.button(:id => 'submit').click
  end
end

Then /^I will be logged in$/ do
  #if @browser.button(:id => 'submit').exists?
  #  #code
  #end
  
  @browser.a(:href => 'https://secure.newegg.com/NewMyAccount/Index.aspx').should == @browser.a(:text => 'klink rtroha')
end

